package com.yxym.single;

public class Single01 {
    public static void main(String[] args) {
        Student student = Student.getInstance();
        System.out.println(student);
    }
}
class Student{
    private String  name;
    private static Student student = new Student("科科");

    private Student(String name) {
        System.out.println("构造器被调用...");
        this.name = name;
    }
    public static Student getInstance(){
        return student;
    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }
}